package com.techm.carpooling.backend;

import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.preference.PreferenceManager;

public class Settings {
	public static boolean devMode = true;

	public static boolean isOnline(Context context) {
		ConnectivityManager cm = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		return cm.getActiveNetworkInfo() != null
				&& cm.getActiveNetworkInfo().isConnectedOrConnecting();
	}

	// Shared Preferences
	public static String USERNAME = "USERNAME";
	public static String USERNAME_DEFAULT = "";

	public static SharedPreferences getSharedPreferences(Context context) {
		return PreferenceManager.getDefaultSharedPreferences(context);
	}

	public static String getUserName(Context context) {
		return getSharedPreferences(context).getString(USERNAME,
				USERNAME_DEFAULT);
	}

}